package com.example.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 向第三方服务：天气，发送请求，获取天气信息
 * 指定url，则直接向url发送请求，如果只有value，则需要访问nacos获取服务
 * https://getweather.market.alicloudapi.com/lundear/weather1d
 */
@FeignClient(value = "weather-client", url = "https://getweather.market.alicloudapi.com")
public interface WeatherFeignClient {
    @GetMapping("/lundear/weather1d")
    String getWeather(@RequestHeader("Authorization") String auth,
                      @RequestParam("areaCode") String areaCode);
}
